package com.projectnection.server.webservices;

import java.io.IOException;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.google.appengine.repackaged.org.json.JSONArray;
import com.projectnection.server.database.liveFeed.ListLiveFeeds;

@SuppressWarnings("serial")
public class ListLiveFeedServlet extends HttpServlet {

	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws IOException {

		String entityID = request.getParameter("entityID");

		JSONArray entityFeeds = ListLiveFeeds.jsonListLiveFeeds(entityID);

		String answer = Utilities.getCallback(request.getParameter("callback"),
				entityFeeds.toString());

		response.setContentType("text/javascript");

		response.getWriter().println(answer);
	}
}
